package model

import (
	"auth/model/entity"
)

type AuthorityMenuCreateRequest struct {
	MenuId      int64 `json:"menu_id"`
	AuthorityId int64 `json:"authority_id"`
}

type AuthorityMenuUpdateRequest struct {
	ID int64 `json:"id"`

	MenuId int64 `json:"menu_id"`
}

type AuthorityMenuListRequest struct {
	Index int `json:"index"`
	Size  int `json:"size"`

	MenuId int64 `json:"menu_id"`
}

type AuthorityMenuListResponse struct {
	Total int                  `json:"total"`
	Data  []*AuthorityMenuInfo `json:"data"`
}

type AuthorityMenuInfo struct {
	MenuId int64 `json:"menu_id"`

	AuthorityId int64 `json:"authority_id"`
}

type AuthorityMenuDeleteRequest struct {
}

func AuthorityMenusEntityToDto(authorityMenus []*entity.AuthorityMenu) []*AuthorityMenuInfo {
	out := make([]*AuthorityMenuInfo, 0, len(authorityMenus))
	for _, c := range authorityMenus {
		out = append(out, AuthorityMenuEntityToDto(c))
	}
	return out
}

func AuthorityMenuEntityToDto(e *entity.AuthorityMenu) *AuthorityMenuInfo {
	return &AuthorityMenuInfo{

		MenuId: e.MenuId,

		AuthorityId: e.AuthorityId,
	}
}
